hysop.backend.device.autotunable_kernel module

class hysop.backend.device.autotunable_kernel.AutotunableKernel(autotuner_config, build_opts, dump_src=None, symbolic_mode=None, **kwds)[source]

Bases: object

abstract autotune(name, kernel_args, force_verbose=False, force_debug=False, **extra_kwds)[source]

Autotune this kernel with given name and extra_kwds.

classmethod check_cartesian_field(field, dtype=None, size=None, resolution=None, compute_resolution=None, nb_components=None, ghosts=None, min_ghosts=None, max_ghosts=None, domain=None, topology=None)[source]
classmethod check_cartesian_fields(*fields, **kwds)[source]

Check that given fields are compatible (defined on the same domain) By default, also compare dtypes, number of components and size. Checks can be enabled or disabled by using check_[res,cres,size,components,dtype] as boolean keyword arguments.

abstract compute_args_mapping(extra_kwds, extra_parameters)[source]

Return arguments mapping which is a dictionnary with arguments names as keys and tuples a values.

Tuples should contain (arg_position, arg_type(s)) with arg_position being an int and arg_type(s) a type or tuple of types which will be checked against.

abstract compute_global_work_size(work, local_work_size, extra_parameters, extra_kwds)[source]

Compute aligned global_work_size from unaligned global_work_size and local_work_size.

compute_min_max_wg_size(work_bounds, work_load, global_work_size, extra_parameters, extra_kwds)[source]

Default min and max workgroup size.

compute_parameters(extra_kwds)[source]

Register extra parameters to optimize.

compute_work_bounds(max_kernel_work_group_size, preferred_work_group_size_multiple, extra_parameters, extra_kwds, work_size=None, work_dim=None, min_work_load=None, max_work_load=None)[source]

Configure work_bounds (work_dim, work_size, max_work_load). Return a WorkBoundsConfiguration object.

compute_work_candidates(work_bounds, work_load, extra_parameters, extra_kwds)[source]

Configure work (global_size, local_size candidates) given an AutotunerWorkBoundsConfiguration instance and a work_load. Return a OpenClWorkConfiguration instance.

custom_hash(*args, **kwds)[source]
abstract format_best_candidate(extra_kwds, extra_parameters, work_load, global_work_size, local_work_size, kernel, kernel_statistics, src_hash, hash_logs)[source]

Post treatment callback for autotuner results. Transform autotuner results in user friendly kernel wrappers.

abstract generate_kernel_src(global_work_size, local_work_size, extra_parameters, extra_kwds, tuning_mode, dry_run)[source]

Generate kernel source code as a string.

hash_extra_kwds(extra_kwds)[source]

Hash extra_kwds dictionnary for caching purposes.

hash_extra_parameters(extra_parameters)[source]

Hash extra_parameters dictionnary for caching purposes.

input_mesh_info(field)[source]

Create a MeshInfoStruct for an input DisreteCartesianField.

abstract max_device_work_dim()[source]

Maximum dimensions that specify the global and local work-item IDs.

abstract max_device_work_group_size()[source]

Return the maximum number of work items allowed by the device.

abstract max_device_work_item_sizes()[source]

Maximum number of work-items that can be specified in each dimension of the work-group.

mesh_info(name, mesh)[source]

Create a MeshInfoStruct from a CartesianMesh.

output_mesh_info(field)[source]

Create a MeshInfoStruct for an output DisreteCartesianField.

class hysop.backend.device.autotunable_kernel.AutotunerParameterConfiguration(**kwds)[source]

Bases: object

Helper class for kernel autotuning to handle extra parameters.

iter_parameters()[source]
property param_names
property parameters
register_extra_parameter(param_name, candidate_values)[source]
class hysop.backend.device.autotunable_kernel.AutotunerWorkBoundsConfiguration(work_dim, work_size, min_work_load, max_work_load, max_device_work_dim, max_device_work_group_size, max_device_work_item_sizes, preferred_work_group_size_multiple, **kwds)[source]

Bases: object

Helper class for kernel autotuning to handle work bounds.

iter_work_loads()[source]
property max_device_work_dim
property max_device_work_group_size
property max_device_work_item_sizes
property max_work_load
property min_work_load
property preferred_work_group_size_multiple
property work_dim
property work_size
class hysop.backend.device.autotunable_kernel.AutotunerWorkConfiguration(work_bounds, work_load, min_wg_size, max_wg_size, ordered_workload=True)[source]

Bases: object

property filter_names
property filters
property global_work_size
iter_local_work_size()[source]

Iterates over filtered work sizes.

abstract make_array_args(**arrays)[source]
abstract make_array_offset(dim)[source]
abstract make_array_strides(dim)[source]
abstract make_dt(dtype)[source]
abstract make_parameter(param)[source]
static max_wg_size_filter(local_work_size, max_work_group_size)[source]

Filter out work items by workgroup size given a maximum workgroup size.

static max_wi_sizes_filter(local_work_size, max_work_item_sizes)[source]

Filter out work items by size given a maximum size.

static min_wi_sizes_filter(local_work_size, min_work_item_sizes)[source]

Filter out work items by size given a minimum size.

static ordered_workload_filter(local_work_size)[source]

Filter out work items by decreasing dimensional sizes.

push_filter(filter_name, filter_fn, **filter_kwds)[source]

Push a named local_work_size filter with custom keywords.

set_local_work_size_generator(fn)[source]

Set a custom local_work_size generator that will generated a set of local_work_sizes to be filtered.

property work_bounds
property work_dim
property work_load